/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jesstalk.chatsystem.chatresponse;

import java.util.List;

/**
 *
 * @author Ecky
 */
public class ErrorInfo {
    //Constants
    private static final int CLIENT_BANNED = 0;
    private static final int CLIENT_NOT_FOUND = 1;
    private static final int USER_NOT_FOUND = 2;
    private static final int ROOMNAME_ALREADY_EXISTED = 3;
    private static final int CLIENT_HAS_TOO_MANY_ROOMS = 4;
    private static final int CATEGORY_NOT_FOUND = 5;
    private static final int CLIENT_BANNED_FROM_ROOM = 6;
    private static final int ROOM_NOT_EXISTED = 7;
    private static final int USER_IS_NOT_IN_ROOM = 8;
    private static final int CLIENT_INSUFFICIENT_PREVILEDGE = 9;

    //Vars
    public int id;
    public String msg;

    public ErrorInfo() {
    }

    public ErrorInfo(int id, String msg) {
        this.id = id;
        this.msg = msg;
    }

    public static ErrorInfo clientIsBanned() {
        return new ErrorInfo(CLIENT_BANNED, "User is banned from system");
    }

    public static ErrorInfo clientIsBannedFromRoom(String roomName) {
        return new ErrorInfo(CLIENT_BANNED_FROM_ROOM, "User is banned from room " + roomName);
    }

    public static ErrorInfo userNotFound(String username) {
        return new ErrorInfo(USER_NOT_FOUND, "User " + username + " not found (deleted by admin?)");
    }

    public static ErrorInfo userIsNotInRoom(String username, String roomname) {
        return new ErrorInfo(USER_IS_NOT_IN_ROOM, "User " + username + " is not in room " + roomname);
    }

    public static ErrorInfo clientNotFound() {
        return new ErrorInfo(CLIENT_NOT_FOUND, "Your user information is not found (deleted by admin?)");
    }

    public static ErrorInfo roomNameUnavailable(String roomName) {
        return new ErrorInfo(ROOMNAME_ALREADY_EXISTED, roomName + " already existed!");
    }

    public static ErrorInfo roomIsNotExisted(String roomName) {
        return new ErrorInfo(ROOM_NOT_EXISTED, roomName + " is not existed!");
    }

    public static ErrorInfo clientHasTooManyRooms() {
        return new ErrorInfo(CLIENT_HAS_TOO_MANY_ROOMS, "Client has too many rooms!");
    }

    public static ErrorInfo categoryNotFound(List<String> categ) {
        return new ErrorInfo(CATEGORY_NOT_FOUND, "Category " + categ + " not found!");
    }

    public static ErrorInfo clientHasNoPreviledge(String roomname) {
        return new ErrorInfo(CLIENT_INSUFFICIENT_PREVILEDGE, "Client is not room owner nor moderator in " + roomname);
    }
}
